﻿package framework.core;

/**
 * Creation date: (2003-08-28)
 * @author: administrator
 * 系统操作类
 */
 
public class Action 
{
	public static final String TABLE_NAME = "t_frm_action";

	public static final String CODE = "CODE";
	public static final String NAME = "NAME";
	public static final String NEED_LOGIN = "NEED_LOGIN";
	public static final String REMARK = "REMARK";
	public static final String AUTHOR = "AUTHOR" ;

	private String m_code;
	private String m_name;
	private int    m_need_login;
	private String m_remark;
	private String m_author;

	public static Action fetch(DBConnection con,String code) throws Exception
	{
		Conditions conditions = new Conditions();
		conditions.add(CODE,code);
		DBResult result = DBEngine.doSelect(con,"select * from " + TABLE_NAME,conditions);
		java.sql.ResultSet rs = result.getRs();
		Action action = null;
		if(rs.next())
		{
			action = fetch(rs);
		}
		result.clear();
		return action;
	}
	private static Action fetch(java.sql.ResultSet rs) throws Exception
	{
		Action action = new Action();
		action.initObject(rs);
		return action;
	}
	public String getCode()
	{
		return m_code;
	}
	public String getName()
	{
		return m_name;
	}
	public String getRemark()
	{
		return m_remark;
	}
	public String getAuthor()
	{
		return m_author ;
	}
	public void initObject(java.sql.ResultSet rs) throws Exception
	{
		m_code = rs.getString(CODE);
		m_name = rs.getString(NAME);
		m_need_login = rs.getInt(NEED_LOGIN);
		m_remark = rs.getString(REMARK);
		m_author = rs.getString(AUTHOR);
	}
	public boolean needLogin()
	{
		return m_need_login==ConstDefine.YES;
	}
}
